Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp272297pxf; Wed, 17 Mar 2021 22:54:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNhEl0yhc8YcaQt1ras77FNDPd/3UnJGX9CIWBftc43qgvkGRfh5IwwyTJ4a5iPOe10Au3 X-Received: by 2002:a17:906:cb0a:: with SMTP id lk10mr34180107ejb.479.1616046891891; Wed, 17 Mar 2021 22:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616046891; cv=none; d=google.com; s=arc-20160816; b=Gvw0rBNA6lqRScFd280PHgtwH0ZqfufMGWGkWtoTt0UK/GXmqOvP+P3jIVuY/qscfp 9vXUdyb141f2PCToID150G88Nq3uBAdbQblgnn6Bz5itTgSjBXCKkPM88LXDtUYMU6qe xHCvX4xrtYS4oKur6ulYc7pLD+AR3B2AktKYhEI3z1/UMo63DZJ/cet+y5YYxBsmc/pV K9lN+ihXd1ZLlcV1pfYOdnflv0lJCBQDDzo4FOlVWdz4kdye6WGRT4c6lGePxvgiffY3 vYmWzUOQy9Ay6zY4wsT3uL4O1Pc1TZastYgE4UatNBTpDNQz8AqVRl69dcR3fnuVkmJm 6S4g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HFnvCDyiDf/wXkwBZxcS7hyjxLXnLTp2jBAW0bn33UQ=; b=K7r/6cR9M4FHMc81Onis8cAMyC/KxGU8IcYy8y/BhqJSH0sII0qk08p/pg4I1FMhAz K7V3TAPcNw6GtIrESax4oVNyN13G3pQ3GsaN8gTOmgQCvbmrgBoteZIy2BOtVHrAyInH /tge+soqQVMD5MdRJDgpIsxWYv0Nk5Q7AfmCCOh2K2iWA3on69cBwxMuRTGrocIPN0gA 0bDlw8HINH17vIIj8hVbSiVg1wdvIkp0Dpsn/bObbp8Zzk9QUHiCxBRDwYLquaN+TFRB YIQy7Xmr97qps4+GFwOEjZnVOopQbtAx8emhGQA5FPXhCf2yg+lRuvvBmXRkOUM2XWTB Im4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="MXB/zjXd"; 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 g3si789431edw.592.2021.03.17.22.54.29; Wed, 17 Mar 2021 22:54:51 -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; dkim=pass header.i=@chromium.org header.s=google header.b="MXB/zjXd"; 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 S229512AbhCRFx3 (ORCPT + 99 others); Thu, 18 Mar 2021 01:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbhCRFw7 (ORCPT ); Thu, 18 Mar 2021 01:52:59 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4D95C06174A for ; Wed, 17 Mar 2021 22:52:58 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id gb6so2358760pjb.0 for ; Wed, 17 Mar 2021 22:52:58 -0700 (PDT) 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:content-transfer-encoding:in-reply-to; bh=HFnvCDyiDf/wXkwBZxcS7hyjxLXnLTp2jBAW0bn33UQ=; b=MXB/zjXdp9mm9moKZkRhOBxcpgK+FGMMTS7zXwSq0BNTrtHc5RjCTKABMaBwl2XRH2 1Cx9jAYecE+0q9K7KxUEFr0jIVdVNduxTdQ8C+XhkyeRiIIcPIaHmQgsk2lWg/xsshch Z97QRsNogtrRutzljWF5QJuDnPzdciyYX6d7A= 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:content-transfer-encoding :in-reply-to; bh=HFnvCDyiDf/wXkwBZxcS7hyjxLXnLTp2jBAW0bn33UQ=; b=KrUnZXS6QhguZTnp/TF0O8nrmB1SgZ7uvwUrlSYEcI36vdvhEy+qkNX34o/GwpUmyz 9kpX1rdESGTBWuIsOqUQLsIBonpCW1TMljHWXkG62jLfpyQj2Czu3E/4IYXx6letYwTd QqXWDgypZy1hoIrOseKvWcA3G56LCaoRWbzM3Wwlqjm64RDJ6T8w55ajmysaTdnr0vVe HWuRC7NQzxe2rhFv1Ptn+2fnHQ4w2B/E0sVrRjTJxSVlh8xPykEOfxQzOnSojV+pox/4 wBt3nZR92ypG0ptZW3EiII+fZ9ojiQiNlY7KwyD/2kEK1NA9H6K7ehiWd7ILp6n3vhdm XZMQ== X-Gm-Message-State: AOAM531wWZBRGSYcRDmXX37ihPZ2ze0TMd8q90q31kcHTpLNyA4LWE2s JkwhLHT3W71wc7rh2D0vgGpulg== X-Received: by 2002:a17:90a:5587:: with SMTP id c7mr2450777pji.5.1616046778334; Wed, 17 Mar 2021 22:52:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g18sm900079pfb.178.2021.03.17.22.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 22:52:57 -0700 (PDT) Date: Wed, 17 Mar 2021 22:52:56 -0700 From: Kees Cook To: Valdis =?utf-8?Q?Kl=C4=93tnieks?= Cc: Josh Poimboeuf , Geert Uytterhoeven , linux-hardening@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH RESEND] gcc-plugins: avoid errors with -std=gnu++11 on old gcc Message-ID: <202103172251.F9D770D@keescook> References: <279558.1615192821@turing-police> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <279558.1615192821@turing-police> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 08, 2021 at 03:40:21AM -0500, Valdis Klētnieks wrote: > It turns out that older gcc (4.9 and 5.4) have gnu++11 support, but > due to a gcc bug fixed in gcc6, throw errors during the build. > The relevant gcc bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959 > > Version the option based on what gcc we're using. Is there a better way to detect this than with version checking? -Kees > > Signed-off-by: Valdis Kletnieks > Fixes: 27c287b41659 ("gcc-plugins: fix gcc 11 indigestion with plugins...") > --- > diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile > index b5487cce69e8..cc779973724a 100644 > --- a/scripts/gcc-plugins/Makefile > +++ b/scripts/gcc-plugins/Makefile > @@ -21,8 +21,11 @@ always-y += $(GCC_PLUGIN) > > GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin) > > +# need gnu++11 for gcc 11, but 4.9 and 5.4 need gnu++98 > +GCC_FLAVOR = $(call cc-ifversion, -ge, 1100, 11, 98) > + > plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \ > - -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \ > + -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++$(GCC_FLAVOR) \ > -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \ > -ggdb -Wno-narrowing -Wno-unused-variable \ > -Wno-format-diag > > -- Kees Cook