Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1955081pxu; Fri, 18 Dec 2020 01:52:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxrzcpJk96S2UV6rE150DmtMEYNIzW7wGCUsrb7JnRcwSz4Nb35UBWNrs9VBXI5vcsazCk X-Received: by 2002:a17:906:b217:: with SMTP id p23mr3133420ejz.461.1608285164552; Fri, 18 Dec 2020 01:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608285164; cv=none; d=google.com; s=arc-20160816; b=KcbNgTYdX6sWSZ4c4wmek8rVVYM0+M0XiVKN19x/YPR3XiI3+iyCvR3bhMAVZVvN5u k+OheTNDrkv0CjIjZCVFEnzC/EeN/M1vfBEjdwPKMg31PVz+47PJYzfmNWhMoLIj5e8U r1HPv06fSKU432SGzBL4HgaYZAEidK8j5h6p1kfSnU4eXHikdNoZ3BJ61umwDjqMFNlM uMiOflFuEyfTrqa77U6iKAvkTltLkJybjR2zCwWV4PCSq8/gRUK7Cr7wmLpobEW4J3S+ /vw84s3nlld8kYLE5tOuL8Q9qyB3iUJYej8QJtpt84/9LyaiR7Uiqg6Qsxd1xLCzWvFJ 94NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=alQmUM5+tWJqBj5AGDAC6yCMV4c4CFP866srY1VNulo=; b=wScfwTeK6FT1gQzkjYnHQIIm83ekrabPulOVLPRJxmvB0G6m0if67zJJB7gae5+fSI ZSbzvFPTbVON1iuSjj31rD+p1ctTqNzVYoTKSRvAgne8P87+Xv5jnYQFmgcLNx7xOl3A BpkDqRXFRvPAjno84Uiwk6f9+zKWl0swTjFnRYUeZ89xFUDV6HubO9fE6wFDsZwtT3P/ +HM70Ou1reZqMhOGUShp+k4JyXD/PgF090WE3UM1cKm/2XH9Y+XAx8Rt5G+ky4BDa8CL NLOYUcaUrByKwk7DqEXitB4/omIJ/cCAqW4DHQtYZ7UvdesfhiCB7ht69qQA6XODK1LU vkLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="uW4s18H/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si7833834edi.183.2020.12.18.01.52.21; Fri, 18 Dec 2020 01:52:44 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="uW4s18H/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389031AbgLRJow (ORCPT + 99 others); Fri, 18 Dec 2020 04:44:52 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:34447 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbgLRJov (ORCPT ); Fri, 18 Dec 2020 04:44:51 -0500 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 0BI9hnaF028988; Fri, 18 Dec 2020 18:43:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 0BI9hnaF028988 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1608284630; bh=alQmUM5+tWJqBj5AGDAC6yCMV4c4CFP866srY1VNulo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uW4s18H/citZM+QfCrscS8WfmMi/Mn4nct5x80/L9fR1m/GWAz3ZEpIJAyXvWBMVw F7xYudp8f+khjxr5Pi4qKWlTBzCqmuQHVQeY8hdJCKynAY2+IQ/W4zrpebm3IdkSJC 1ydLE4+FxHBqvW64Mc/tCRBSgjRbH1T7tpGl9EJeYGM7NtaR62IAyC6MLL8UTpgWjk yLnUIGKDC77pA5qEHCUFcJt0ikL0mZJa/oYcOPdvaEpTt4P8IDChI0Wq/mL7yUQh94 2WWzhahUkHIpKsrcJqLbn0rCBWpWnLboLhZjgBmFQ61I7VOPgaof3PhlljEubwki1k 1cDlqJgIB1/kw== X-Nifty-SrcIP: [209.85.210.169] Received: by mail-pf1-f169.google.com with SMTP id w6so1235918pfu.1; Fri, 18 Dec 2020 01:43:50 -0800 (PST) X-Gm-Message-State: AOAM532SOnYrZ1bLpARS0aONbyyjNZzXdn6Cwsz0WEigWHfh/HDUnZXv 1Yucjq41FYQbSl4ymbxcx9VFq5q20mIJhRGN5yM= X-Received: by 2002:a65:6a16:: with SMTP id m22mr3370270pgu.175.1608284629399; Fri, 18 Dec 2020 01:43:49 -0800 (PST) MIME-Version: 1.0 References: <20201203125700.161354-1-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Fri, 18 Dec 2020 18:43:12 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] gcc-plugins: simplify GCC plugin-dev capability test To: Marek Szyprowski Cc: Linux Kbuild mailing list , Kees Cook , Emese Revfy , linux-hardening@vger.kernel.org, Linus Torvalds , Nathan Chancellor , Nick Desaulniers , clang-built-linux , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 18, 2020 at 4:58 PM Marek Szyprowski wrote: > > Hi, > > On 03.12.2020 13:57, Masahiro Yamada wrote: > > Linus pointed out a third of the time in the Kconfig parse stage comes > > from the single invocation of cc1plus in scripts/gcc-plugin.sh [1], > > and directly testing plugin-version.h for existence cuts down the > > overhead a lot. [2] > > > > This commit takes one step further to kill the build test entirely. > > > > The small piece of code was probably intended to test the C++ designated > > initializer, which was not supported until C++20. > > > > In fact, with -pedantic option given, both GCC and Clang emit a warning. > > > > $ echo 'class test { public: int test; } test = { .test = 1 };' | g++ -x c++ -pedantic - -fsyntax-only > > :1:43: warning: C++ designated initializers only available with '-std=c++2a' or '-std=gnu++2a' [-Wpedantic] > > $ echo 'class test { public: int test; } test = { .test = 1 };' | clang++ -x c++ -pedantic - -fsyntax-only > > :1:43: warning: designated initializers are a C++20 extension [-Wc++20-designator] > > class test { public: int test; } test = { .test = 1 }; > > ^ > > 1 warning generated. > > > > Otherwise, modern C++ compilers should be able to build the code, and > > hopefully skipping this test should not make any practical problem. > > > > Checking the existence of plugin-version.h is still needed to ensure > > the plugin-dev package is installed. The test code is now small enough > > to be embedded in scripts/gcc-plugins/Kconfig. > > > > [1] https://lore.kernel.org/lkml/CAHk-=wjU4DCuwQ4pXshRbwDCUQB31ScaeuDo1tjoZ0_PjhLHzQ@mail.gmail.com/ > > [2] https://lore.kernel.org/lkml/CAHk-=whK0aQxs6Q5ijJmYF1n2ch8cVFSUzU5yUM_HOjig=+vnw@mail.gmail.com/ > > > > Reported-by: Linus Torvalds > > Signed-off-by: Masahiro Yamada > > This patch landed in linux next-20201217 as commit 1e860048c53e > ("gcc-plugins: simplify GCC plugin-dev capability test"). > > It causes a build break with my tests setup, but I'm not sure weather it > is really an issue of this commit or a toolchain I use. However I've > checked various versions of the gcc cross-compilers released by Linaro > at https://releases.linaro.org/components/toolchain/binaries/ and all > fails with the same error: > > $ make ARCH=arm > CROSS_COMPILE=../../cross/gcc-arm-10.2-2020.11-x86_64-arm-none-eabi/bin/arm-none-eabi- > zImage > HOSTCXX scripts/gcc-plugins/arm_ssp_per_task_plugin.so > In file included from > /home/mszyprow/dev/cross/gcc-arm-10.2-2020.11-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/plugin/include/gcc-plugin.h:28:0, > from scripts/gcc-plugins/gcc-common.h:7, > from scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3: > /home/mszyprow/dev/cross/gcc-arm-10.2-2020.11-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/plugin/include/system.h:687:10: > fatal error: gmp.h: No such file or directory > #include > ^~~~~~~ > compilation terminated. > scripts/gcc-plugins/Makefile:47: recipe for target > 'scripts/gcc-plugins/arm_ssp_per_task_plugin.so' failed > make[2]: *** [scripts/gcc-plugins/arm_ssp_per_task_plugin.so] Error 1 > scripts/Makefile.build:496: recipe for target 'scripts/gcc-plugins' failed > make[1]: *** [scripts/gcc-plugins] Error 2 > Makefile:1190: recipe for target 'scripts' failed > make: *** [scripts] Error 2 > > Compilation works if I use the cross-gcc provided by > gcc-7-arm-linux-gnueabi/gcc-arm-linux-gnueabi Ubuntu packages, which is: > > $ arm-linux-gnueabi-gcc --version > arm-linux-gnueabi-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 > > Best regards > > -- > Marek Szyprowski, PhD > Samsung R&D Institute Poland > I can compile gcc-plugins with Linaro toolchians. The version of mine is this: masahiro@oscar:~/ref/linux-next$ ~/tools/arm-linaro-7.5/bin/arm-linux-gnueabihf-gcc --version arm-linux-gnueabihf-gcc (Linaro GCC 7.5-2019.12) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Maybe, it depends on the host environment? Please try this: $ sudo apt install libgmp-dev -- Best Regards Masahiro Yamada