Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp123785pxb; Tue, 14 Sep 2021 20:47:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNCNmtY4l1/LXyfZ+i83BQcWDbd8anlcXOtiSm1qCpUFYxr3z90uRMEH33RfRFFh5YfNqo X-Received: by 2002:a05:6e02:20cd:: with SMTP id 13mr14966016ilq.156.1631677666393; Tue, 14 Sep 2021 20:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631677666; cv=none; d=google.com; s=arc-20160816; b=yDEutSaW1/nS8650mHDtZtfMIvQQY/Zlpy7ykyvmA7VaaGFF2P0PgIj45yXlrKgyAG +TrMo285y81OuDNLesa5P9WSid8AipEG+wCL7iKLlKyH/W2EEK2PjlkTpkBkEwnuahPN foYU9ZQrCKowNb3hR7Y1HVrsD0tp0hqZVVb3MbQ8EJw2Z8K9OGMXYbLGV4VWWq0oMKhK PYkeXCi/nI7CG9BPr8/Rl+wX4sk98ZW7ZhvZ91ucFBhxMU+SS0jBU9c2bcF7EqAQ6/6c JuU1NKYyIqQOkx4SYKTXwMX58ChLK/BsfQvqyOkMwvD5uXpXLcPkKvE1eJr1/p0JOHRg G5QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=bxK8owSxySs17nlpjD3YHlTzKgKmaEXR6jX63Y28gms=; b=FbZNyMjUCFeSRKQsySdxuEwWMwWREv1nXTXDjjMxklLXUCpxYoIrzOiTpVSgqpysfu l1esJ7MTRO5LrETz2hqRDkbNCQDussBw6nQHWMZLhMX24p86FMHxQqqwn1rxUS9e71Oi URYXhHIW8HlSht+WKSYkIGGgxxlrDi/1wCwqzBZG+xdtdbKWau5XRGZXVGqQO/U9OYHS HyjgOU63N5Bkr60jIKzgbhi02pfltALrUcfDmfcQOvoWx+Scn2De3UtaLHy2EDzQRB7a jNUvOk3Y39F0gr6WkDuiW0pon5fkADJ4xbFh+TypILm+qyusSOs90rJpYJEc20/z/xic M0Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uVeA6QWK; 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 r19si11666985ilh.119.2021.09.14.20.47.34; Tue, 14 Sep 2021 20:47:46 -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=@kernel.org header.s=k20201202 header.b=uVeA6QWK; 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 S233232AbhIODq7 (ORCPT + 99 others); Tue, 14 Sep 2021 23:46:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbhIODq6 (ORCPT ); Tue, 14 Sep 2021 23:46:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4B9F26108F; Wed, 15 Sep 2021 03:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631677540; bh=fcKJT4RQ2NWXn1tWEahtcJTu2maR6TNE633Y37N45I4=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=uVeA6QWK4eIX9nJzAvSaE49VnnmAlFLs0J+HLMKTiX3E62P+Msb8rVSj9aRMZj5UG FWy050L3jS56dZ8g1pXol6mN40zyIzYa5Q17irVNpT4fBACTsJjxy7xpUPnlo17wR0 B3jaRgvopcBv2P+7UhXCE95TP/N+OhC16XNH7aCy4e0sZFnskjnPqC9+tMKji6j0NO 0XPG5Xfn5R7nIoqtOeWK3pqIzWKGEnmDUo1R98dnAP0PBQ3tKN9+OVKQej+soBU+jM 9zHc2pdwD7mvbdRXzoTVJRmYyDAuDsyvrkNmNdl4QbHeNOuT8q94jBzgr2oEu8rI0A a5tNo2d2bl++A== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: linux: build failure: error: "__has_attribute" is not defined From: Nathan Chancellor In-Reply-To: Date: Tue, 14 Sep 2021 20:45:39 -0700 Cc: Tetsuo Handa , Nick Desaulniers , Kees Cook , Stephen Rothwell , LKML Content-Transfer-Encoding: quoted-printable Message-Id: <91B93D4D-BEC8-4ACD-B71F-27C54D8B1B78@kernel.org> References: <3bf6f4f4-9c96-6e0c-951d-5509175dddfe@kernel.org> To: Linus Torvalds X-Mailer: Apple Mail (2.3654.120.0.1.13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 14, 2021, at 7:59 PM, Linus Torvalds = wrote: > 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. >=20 > The gcc docs are fairly clear about how to test for __has_attibute = correctly: >=20 > https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html >=20 > and a host build environment should probably have used >=20 > #if defined __has_attribute > # if __has_attribute (error) > ... >=20 > and not used any version checks at all. Ugh, yes, I had assumed that the host compiler would always equal the compiler used for the kernel because I am so used to clang so I figured the 'defined(__has_attribute)' was redundant but that obviously is not true, especially when cross compiling. > 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. >=20 > Anybody want to tackle those issues in >=20 > tools/include/linux/overflow.h > tools/include/linux/compiler-gcc.h >=20 > and try to simplify the code? I made the tools/include/linux/compiler-gcc.h situation worse so I am more than happy to try to resolve it. __compiletime_error() is ultimately used within BUILD_BUG_ON(), which does appear to be used a couple places within the tools/ directory so I am not sure it should be eliminated; doing so would cause BUILD_BUG_ON() failures to be a lot more cryptic (although it is entirely possible those are not at all common so who cares). I could be entirely wrong though if I am misreading the code, there are a few different BUILD_BUG_ON() defines... If it cannot be eliminated, we could either add back the GCC_VERSION >=3D 40300 check (because there does not appear to be a minimum host version of GCC) along with my fix or we could just do the 'defined(__has_attribute)' and leave GCC 4.3 to 5.1 behind. I do not have a strong opinion. Cheers, Nathan=