Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp101926pxb; Tue, 14 Sep 2021 20:01:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeIc8k2EwXk3E+KUoc4v+4EphMkTbmNLNiqQHTQxvgUeJAGuIU5YwWD2Kpj+396yV2Y11s X-Received: by 2002:a05:6512:2213:: with SMTP id h19mr15896226lfu.598.1631674908363; Tue, 14 Sep 2021 20:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631674908; cv=none; d=google.com; s=arc-20160816; b=zQdYypT9Qdmyb6cXPOTSNkJWM36LaBpmkt6Ms6W+tnVcSPPmPCb4ScupYUtWHoTRdP TA1LNN+I7j4zM8t1fIY5r3EZMiW9NCYIkapb9CfYFucNW8KBFGk2piV9wSBown664uqi 7PGT5mypstAZCTD/fjnpIQkq0rYXbxHzgtwHydb1LeLMabRLORypH9aMCu8kuh30sfU7 Fhkzna0ihzYaEKtoY5Iv4U7MtbMp27Xf7epFxjjD36cP+swsHzXhLZalZCqJd6BeB4v/ eMC+F9Ifw42CxJfKhszKk6QJ0WmjO3Mv457vdh+Kw4V87+0c1ejSFDz5hr4JWngvqXzB h66g== 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; bh=zbADmf0RfotFPk92OptkWggkubEXHwFuB6jYYoTJjjo=; b=zopn4znj1dS/WXaJ4Gca6ZSpaEhKIMjjo4H/PSisZCQF/kzDM+bw+Xo5UQlY4h7FXb P27jWMv1V19sv41U/pmxotr9M6M2GZHTg0YpUbzc6lDCRiz+1sPIq7kyC+bIeEqmPSHG UoiWgbhUQ8TpsqZ18SyALVDXrNMEdGQjpI9Mmp5r3UaMRku+9brx8RloU61dAajm1H5N my2wjB5IoyrCqkWv2TMAsaCuHPM3lWGHwlPmcojCSA/+TXleifpJ+8n88tcpQlEY+lin 4jioBrUeRZIAC7u5PHQ8dcCkss5vnyhWIJDm0XTJ5ig5MUqoin5PtVmN26HpGuTNERHh y3KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Qhe9JZ+Z; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si11019755lfq.420.2021.09.14.20.01.19; Tue, 14 Sep 2021 20:01:48 -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=@linux-foundation.org header.s=google header.b=Qhe9JZ+Z; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231847AbhIODBC (ORCPT + 99 others); Tue, 14 Sep 2021 23:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbhIODBB (ORCPT ); Tue, 14 Sep 2021 23:01:01 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8F65C061574 for ; Tue, 14 Sep 2021 19:59:42 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id bq5so2909432lfb.9 for ; Tue, 14 Sep 2021 19:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zbADmf0RfotFPk92OptkWggkubEXHwFuB6jYYoTJjjo=; b=Qhe9JZ+ZJ18xY02mFI4UlB1jQpdVQDRzQirW5vqP2RIgbNdCjhen7dYsCuzh5X2O8r VjlajUvy80zson73wivnbCYm7VyGI2ZDR0yYns+s54IFkWHDG355MWyGDMVhqFBm3FAE u0JN0MuNDZj316iZDvTrYS1xxa7Shsss8OsoA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zbADmf0RfotFPk92OptkWggkubEXHwFuB6jYYoTJjjo=; b=R32gYyzyKgA3N02vu2l6R8wl8vuyaOIrd/80AXkVEhL1w/f3y1qBJPaaEDo8OQklyO 00LMORbRpi4N2pnns7m2m1e/k4USqDjlrOX1h7BUDjZThrdMwBreWHTn1XBW85fTFCV/ 6w4XPnR6WDdO3gyKNF9s2TjxVgf1gsNW8WLJC8Y45BtHrgDSDPyeN84dxdaSMw8HhNI7 vJ7VsS/vS+RGEJecddx8c1uH76pp/5Ca3w5wohSrHyrbYaMrhx4Z9/I0qPSmi1lrG+Xp Grdbs8k+ETPZ7PY+mrbjhB1SjFC7zZcbafZaNSYJWn3Lyaz5jIdZ1iH61I/yoHqFQklW 9jTg== X-Gm-Message-State: AOAM5314h/OyoufvX2GaTHYIjQrjbqFNfOe2UCLOQyLVUYsQQz6h4c4T qQsPTYYJhmJnRBfhzMgOwuyReaABdQd/xVHHGaQ= X-Received: by 2002:a05:6512:3b0f:: with SMTP id f15mr9359842lfv.169.1631674780522; Tue, 14 Sep 2021 19:59:40 -0700 (PDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id u24sm1507114ljg.64.2021.09.14.19.59.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Sep 2021 19:59:39 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id i4so2970426lfv.4 for ; Tue, 14 Sep 2021 19:59:39 -0700 (PDT) X-Received: by 2002:a19:ae15:: with SMTP id f21mr5942103lfc.402.1631674779201; Tue, 14 Sep 2021 19:59:39 -0700 (PDT) MIME-Version: 1.0 References: <3bf6f4f4-9c96-6e0c-951d-5509175dddfe@kernel.org> In-Reply-To: From: Linus Torvalds Date: Tue, 14 Sep 2021 19:59:23 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: linux: build failure: error: "__has_attribute" is not defined To: Tetsuo Handa , Nick Desaulniers , Kees Cook Cc: Nathan Chancellor , Stephen Rothwell , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 6:05 PM Tetsuo Handa wrote: > > It would be nice if Makefile can also check gcc version used for building tools. I think the real problem is that the tool headers are cut-down from the real kernel headers, but not cut down enough, so they are still very complex, often with stuff that just isn't worth it in user space at all. And they _look_ like kernel headers - both in naming and in contents. But they really aren't. And it turns out there are two independent bugs here. Bug #1 is that the tool header files look _so_ much like the main kernel header files, that Nick thought that the #if GCC_VERSION >= 40300 was about the compiler we compile the kernel with. But no, it's about the host compiler. Easy mistake to make when the naming is so similar and the contents are often also fairly closely related too. But basically, commit 4e59869aa655 ("compiler-gcc.h: drop checks for older GCC versions") was buggy, because it took the kernel compiler version logic ("we require 5.1 to build the kernel") and applied it to the tooling header files too (we do _not_ require the kernel compiler for host tools). Now, arguably, commit 4eb6bd55cfb2 ("compiler.h: drop fallback overflow checkers") has the exact same problem: it too ends up changing both the kernel header files and the tooling header files. But tooling really REALLY shouldn't be using those overflow macros, so nobody should care. Famous last words. I think we should remove that "tools/include/linux/overflow.h" header entirely. Yes, it is used - by tools/virtio/linux/kernel.h. But I think that overflow handling code should be removed. It's just not interesting in user tools. Now, the _second_ bug was then that when Nathan fixed the tooling header file in commit d0ee23f9d78b ("tools: compiler-gcc.h: Guard error attribute use with __has_attribute"), he did it the wrong way. The gcc docs are fairly clear about how to test for __has_attibute correctly: https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html and a host build environment should probably have used #if defined __has_attribute # if __has_attribute (error) ... and not used any version checks at all. Of course, I'm not convinced it should do that __compiletime_error() at all, and again, I think it would be better to remove the complexity rather than anything else. Anybody want to tackle those issues in tools/include/linux/overflow.h tools/include/linux/compiler-gcc.h and try to simplify the code? Linus