Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp725737pxu; Fri, 4 Dec 2020 14:05:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzu7MS5tTBwwj8vF4AEBv2v8qDHgijrW8bBnAa0wHtd4mwVyehot9WrgCnw2AedkbxttGM1 X-Received: by 2002:a05:6402:3074:: with SMTP id bs20mr9671024edb.365.1607119512710; Fri, 04 Dec 2020 14:05:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607119512; cv=none; d=google.com; s=arc-20160816; b=bRvgU6aBCl9Lt9U5ZrPf++PaV/GMCtH1G5a40Uwxv8qVbogqYGXNFJbSU76glelHXv gEWp22m/hh5h2rfsDWLA8QGRRYlsOVEb2HoJtY7gwGP94elMLzKtod+PQV9DQbhu/F1a eFWThg1EXPk/L8BfjIFY/FgxHCCDSrthplB5Sjg3Uta0+qxcwKYk/pkCTsNZISBbrLqt zM6dDxMimcb+lO3EEUqfb8Ax3v8ROH0obK6d4CcpqDOjR6xHmLTqmlC9uWQdYTNITb7m s7SWNM7W1R2QMZske/0Cxc52g3oCSBRNS0kqt+/r+Ezr8RMLOOTzFBU1wK0MTET58hIg ZQsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=enW7VRg0zeMyiDIIOokOnpbP5Go5lgWeBVKjANCM8QE=; b=aiUq6aqs681trwF2HAAxckykrNuVFZtynwjq4A6YcKvmlhf33Gpiv2/iZoO9wFXS30 sdnbzxFBye7Mj6cN8sTJvSPInO1KqoTh3d0ZR3pa+B4PO9gNy2MgEZoDPpAKPFf+5WPg dGOehnXzHubomoGRniIoAr627aBuP3zXN7Q1jpMP2xgiOehtJCaeS0Vc2++4V1qxf84i 5UiGSncWgqlcvs7h/ND9Jhpu3AV0aXgHoiXkWPUavoaWF9driBcCJYAqO+876CeCtnJr a1MY+xS3PnKcFQFOdAyprigTeIYcNqmfZfzKy0lIY6WGUukAqRyMJncaHA5Ukyp0vHqu hGEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WSBivQGw; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si2180634ejc.271.2020.12.04.14.04.49; Fri, 04 Dec 2020 14:05:12 -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=@chromium.org header.s=google header.b=WSBivQGw; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbgLDWDI (ORCPT + 99 others); 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-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