From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8242CC4361A for ; Fri, 4 Dec 2020 22:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2976B22CA0 for ; Fri, 4 Dec 2020 22:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729456AbgLDWDI (ORCPT ); Fri, 4 Dec 2020 17:03:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbgLDWDI (ORCPT ); Fri, 4 Dec 2020 17:03:08 -0500 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5302C061A51 for ; Fri, 4 Dec 2020 14:02:27 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id h7so4398107pjk.1 for ; Fri, 04 Dec 2020 14:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=enW7VRg0zeMyiDIIOokOnpbP5Go5lgWeBVKjANCM8QE=; b=WSBivQGw0NWLYaFd2OPXxdWfo5/ZEqUNT+h7R43nqoDXNRmh7641AbBNX9GjdmhVaP ovd+v6GiD5CTuIZenDiMSBDlxmYd6x6o7x8tQbNsw8CbHcRoBB6wz5dQbLh0Hrq4yA8c RoGXszwIKaMlZbIQYlcz0HrYcstfZkVfTomvk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=enW7VRg0zeMyiDIIOokOnpbP5Go5lgWeBVKjANCM8QE=; b=TZXmLh0+l4izOw40w7o20vTcynRQs/c4nXOwfqZmFwnwfG8ASBNIrlXnMSd1c110oO u5Sst9xLPJfRsqf4oBn+cPCOkqtHQUileq3BXCP/hssZwXDgZhRI8//oQbllGW0mhG5k 4ZgX7OdzVqljI4pN83xiljI9ZzQ/Mam4JHS7sHkLK2LPGJf2KtxDHNnY6sRQXa3EakYZ n1kkk2pV2OgFuQHvA+HTyBuza/QqlGntXJT42us8MZRC3QnqIki77wf8n28opVjzrRCP qeLrEEwxc2a19NZId8T1Q7cqA8JIuPGn8jLZZPNWmn81jwGe6Uj/iI8A8N55gyK/W+lT GdNA== X-Gm-Message-State: AOAM530LMLbFYG903iZ6MhBSTzgjUb4nnHAoeTrpalgkzT/Rq+YdFsfL mNNJuwW8nIncKbbdx6e66uFa4g== X-Google-Smtp-Source: ABdhPJwU6a9D2gVWjKe1CROF33gGSIaZEj8/GDUhF/uRcH+xF+acQH0ncmbYv1G3SVC4Cka04+puNw== X-Received: by 2002:a17:902:6b:b029:da:725b:fcea with SMTP id 98-20020a170902006bb02900da725bfceamr5727914pla.16.1607119347328; Fri, 04 Dec 2020 14:02:27 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f92sm3353946pjk.54.2020.12.04.14.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 14:02:26 -0800 (PST) Date: Fri, 4 Dec 2020 14:02:25 -0800 From: Kees Cook To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Emese Revfy , linux-hardening@vger.kernel.org, Linus Torvalds , Nathan Chancellor , Nick Desaulniers , clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gcc-plugins: simplify GCC plugin-dev capability test Message-ID: <202012041402.97F582B00C@keescook> References: <20201203125700.161354-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201203125700.161354-1-masahiroy@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03, 2020 at 09:57:00PM +0900, 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 Acked-by: Kees Cook -- Kees Cook