Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp953433pxv; Fri, 9 Jul 2021 13:15:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2dDXaQmlRT77Lu6l5EChV3s85JuOOdIwYoZLKbpoWwOOwqY8f4rEvS/wdabFoFAexBClm X-Received: by 2002:a17:907:2bc7:: with SMTP id gv7mr40048537ejc.417.1625861736388; Fri, 09 Jul 2021 13:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625861736; cv=none; d=google.com; s=arc-20160816; b=ZZT2sCdndE088JwjvOWhwrA46gykW38skhhc+eXycWZPvYVuo9kGcf+JcCBh2bE2KH hTsIl6tcy4Ci6Nr+/UKLLPM6+z5n6BX5kax+ZsY2JW818Pxma7OnHEqQVFjNojxR9KYV TYLMpsNYjp+cyDrUb5tGRaPla3hW4K/9CPDQp3+IP1vTp1MMOnLkhYsZ58r2pEqHByG+ DFOQ9K2p4c6nrHeMjNKGQ2q401aisec3VEQWO+YfRuPOVZZUccV6IRkTqg3um50M8Wd5 4//ELrN80fSZ5DohfbmN+T7oVYmlcBk/b8SLIPK0iOMd7abSDNtz64TWnazgNwqpKsoB 6A2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=UKKvVfA882zYSWY6L4i61xl8LSKN3Jx/Sr2g96QM0iQ=; b=AJY9MkcyEATkNv8kN5s4KvZIRgNF+/d6aEyVOpVKrKdAVaqaMM5LpUZtqAmBC3YbQO IOAjgH4qpC7Ss/0X/lKJG94FtTbK734BKbyesNxz94nO3e5vB4AH9LHXiqHpIUKn9Icd 7mIWy8ctLyhun8EaJ18WZbfGmC+JaCoG5dpE37MIsCXSTuhhTaYp0iWJOayAd/ikaXLZ C4fmWe46rbVHoF1MX+yfbBLRjMjB2yxHGlpsz7NBciMquWNFBGDnbwUtLouaibwBUaUA P2Mnd2K1DD4wsB4ZHokfe1EA5p+JbzdiWKYduEWcbgtgTYzViSRREjqmqhqKSqTwticx yCew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n23Wiiqx; 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 hw7si8510056ejc.479.2021.07.09.13.15.13; Fri, 09 Jul 2021 13:15:36 -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=n23Wiiqx; 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 S229606AbhGIUOy (ORCPT + 99 others); Fri, 9 Jul 2021 16:14:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:38170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbhGIUOx (ORCPT ); Fri, 9 Jul 2021 16:14:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFA69613AB; Fri, 9 Jul 2021 20:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625861529; bh=DL2873M8Z+eG0pLPihjVaDqpeBObpt8oA1y2q95ITLg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=n23WiiqxLb5bprTf7rnrdb6W1hHHRFQZjIsHw47lrgvJY3KEMAnnhorH9NJ3GAbtd 0zu/fwB/sFo4pQlZulDLf8lWlIs0cUsKvzJS9onTnQz1pnjA4JPb42b9wIxamxle4O XxlNpuW3xRyge/Xuyb82lZ4Xoor+TqrsGeWFB1SdGvM0+OVByyAR6NUOcsUoH8awbR 0L5EmkYFquz19cbF6JVRUNvAPezaSkqYQtI0e/0Atmh2p/mhFVoGQv9cttqHISeS8U SixGmggusxPBxdOjm9vnAQf6sqn/K6A0OUPeRq1MUZHMHRK4EgKijaU/BwxiMdo5TU 3UZx/uOKtvjfg== Subject: Re: [PATCH v2 1/2] Makefile: move initial clang flag handling into scripts/Makefile.clang To: Nick Desaulniers , Masahiro Yamada Cc: Miguel Ojeda , Fangrui Song , Michal Marek , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, Geert Uytterhoeven , Christoph Hellwig , Linus Torvalds References: <20210708232522.3118208-1-ndesaulniers@google.com> <20210708232522.3118208-2-ndesaulniers@google.com> From: Nathan Chancellor Message-ID: <9f66019d-6207-1d4b-0a80-30f09b819ff4@kernel.org> Date: Fri, 9 Jul 2021 13:12:08 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210708232522.3118208-2-ndesaulniers@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/8/2021 4:25 PM, 'Nick Desaulniers' via Clang Built Linux wrote: > With some of the changes we'd like to make to CROSS_COMPILE, the initial > block of clang flag handling which controls things like the target triple, > whether or not to use the integrated assembler and how to find GAS, > and erroring on unknown warnings is becoming unwieldy. Move it into its > own file under scripts/. > > Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor > --- > MAINTAINERS | 1 + > Makefile | 15 +-------------- > scripts/Makefile.clang | 14 ++++++++++++++ > 3 files changed, 16 insertions(+), 14 deletions(-) > create mode 100644 scripts/Makefile.clang > > diff --git a/MAINTAINERS b/MAINTAINERS > index 81e1edeceae4..9c1205c258c7 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -4433,6 +4433,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues > C: irc://chat.freenode.net/clangbuiltlinux > F: Documentation/kbuild/llvm.rst > F: include/linux/compiler-clang.h > +F: scripts/Makefile.clang > F: scripts/clang-tools/ > K: \b(?i:clang|llvm)\b > > diff --git a/Makefile b/Makefile > index cbab0dc53065..010e3a4e770b 100644 > --- a/Makefile > +++ b/Makefile > @@ -586,20 +586,7 @@ endif > CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1)) > > ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) > -ifneq ($(CROSS_COMPILE),) > -CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) > -endif > -ifeq ($(LLVM_IAS),1) > -CLANG_FLAGS += -integrated-as > -else > -CLANG_FLAGS += -no-integrated-as > -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) > -CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) > -endif > -CLANG_FLAGS += -Werror=unknown-warning-option > -KBUILD_CFLAGS += $(CLANG_FLAGS) > -KBUILD_AFLAGS += $(CLANG_FLAGS) > -export CLANG_FLAGS > +include $(srctree)/scripts/Makefile.clang > endif > > # Include this also for config targets because some architectures need > diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang > new file mode 100644 > index 000000000000..297932e973d4 > --- /dev/null > +++ b/scripts/Makefile.clang > @@ -0,0 +1,14 @@ > +ifneq ($(CROSS_COMPILE),) > +CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) > +endif > +ifeq ($(LLVM_IAS),1) > +CLANG_FLAGS += -integrated-as > +else > +CLANG_FLAGS += -no-integrated-as > +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) > +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) > +endif > +CLANG_FLAGS += -Werror=unknown-warning-option > +KBUILD_CFLAGS += $(CLANG_FLAGS) > +KBUILD_AFLAGS += $(CLANG_FLAGS) > +export CLANG_FLAGS >