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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 55439C4338F for ; Mon, 2 Aug 2021 16:53:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 234C0610FF for ; Mon, 2 Aug 2021 16:53:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 234C0610FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Mime-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=amCMrJOqX9uUf6iKWuf7I+wceelyursz6vLCn0y3N5c=; b=25RSgCn0QhjKEW lCercmRpddDBVZv+Jh1EcW4GNEeZc3wCwrZe9heqFyG+t2EdSf/FizbfqR881GWFzllup0hokjweb WeR6J1a4mErrNiBEehh+4cmh1NCcBU3OO8NxsxZMlCgNHZMDX74H6y/Y0gm9XxmdhXKFfsSLynYIp sMw3GfFDkb9hbwVEtXEKyX07MZig1CHHjj+XUTc6LT34BBifHe5VTJDqOgpwpHr+hlZTNGBnTaSw7 8b3tr9pPTcADfbw2b4hn52cE0UxI7c4Ixn0R7fRQu9D1fkPmrS7KOnVC/qJR08epECgkqNxSiCVaF WWbPBkpy8y1WRmt8JoVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAb9a-00HEPB-Km; Mon, 02 Aug 2021 16:51:02 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAb9V-00HENc-JR for linux-arm-kernel@lists.infradead.org; Mon, 02 Aug 2021 16:50:59 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 172GlmVS025072; Mon, 2 Aug 2021 11:47:48 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 172Gllk1025071; Mon, 2 Aug 2021 11:47:47 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 2 Aug 2021 11:47:47 -0500 From: Segher Boessenkool To: Alexey Dobriyan Cc: akpm@linux-foundation.org, linux-arch@vger.kernel.org, Catalin Marinas , masahiroy@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Paul Mackerras , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/3] isystem: delete global -isystem compile option Message-ID: <20210802164747.GN1583@gate.crashing.org> References: <20210801201336.2224111-1-adobriyan@gmail.com> <20210801201336.2224111-3-adobriyan@gmail.com> <20210801213247.GM1583@gate.crashing.org> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210802_095057_818082_41EF0FE7 X-CRM114-Status: GOOD ( 25.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 02, 2021 at 09:42:45AM +0300, Alexey Dobriyan wrote: > On Sun, Aug 01, 2021 at 04:32:47PM -0500, Segher Boessenkool wrote: > > On Sun, Aug 01, 2021 at 11:13:36PM +0300, Alexey Dobriyan wrote: > > > In theory, it enables "leakage" of userspace headers into kernel which > > > may present licensing problem. > > > > > -NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) > > > +NOSTDINC_FLAGS += -nostdinc > > > > This is removing the compiler's own include files. These are required > > for all kinds of basic features, and required to be compliant to the C > > standard at all. > > No they are not required. This is false, they *are* required, whenever you want to use these features. If you do not include the required headers you get undefined behaviour. > Kernel uses its own bool, uintptr_t and > static_assert, memset(), CHAR_BIT. Yes, and it occasionally gets it wrong. Great fun. See c46bbf5d2def for the latest episode in this saga. (Yes I know this is uapi so maybe not the best example here, but it isn't like the kernel gets such things wrong so often these days ;-) ) The kernel *cannot* make up its own types for this. It has to use the types it is required to use (by C, by the ABIs, etc.) So why reimplement this? > noreturn, alignas newest C standard > are next. What is wrong with and ? > This version changelog didn't mention but kernel would use > -ffreestanding too if not other problems with the flag. It is still true for freestanding C implementations, you just get a severely reduced standard library, > > These are not "userspace headers", that is what > > -nostdinc takes care of already. > > They are userspace headers in the sense they are external to the project > just like userspace programs are external to the kernel. So you are going to rewrite all of the rest of GCC inside the kernel project as well? > > In the case of GCC all these headers are GPL-with-runtime-exception, so > > claiming this can cause licensing problems is fearmongering. > > I agree licensing problem doesn't really exist. > It would take gcc drop-in replacement with authors insane enough to not > license standard headers properly. There does still not exist a drop-in replacement for GCC, not if you look closely and/or rely on details (like the kernel does). Some of the differences are hidden by "linux/compiler-*.h", but hardly all. > > I strongly advise against doing this. > > Kernel chose to be self-contained. That is largely historical, imo. Nowadays this is less necessary. Also, the kernel chose to *do* use the compiler include files. It is you who wants to abolish that here. > -isystem removal makes sense then. -nostdinc -isystem $(shell $(CC) -print-file-name=include) makes sense for that: you do indeed not want the userspace headers. Maiming the compiler (by removing some of its functional parts, namely, its generic headers) does not make sense. > It will be used for intrinsics where necessary. Like, everywhere. Segher _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel