Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1926769pxy; Mon, 2 Aug 2021 14:07:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR8sJJgCcDRTsYL+ZUZQE5s2ecTx8qwI6UVLWjuON+OedKIz2+KuQiqst54TonjW0K5d+z X-Received: by 2002:a05:6e02:1a46:: with SMTP id u6mr663003ilv.135.1627938437963; Mon, 02 Aug 2021 14:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627938437; cv=none; d=google.com; s=arc-20160816; b=GoQdjas67THqn1PlwidauamXWaciS+7KVTUFy1b52YuH26yRqVb+WQ2+25X/DwaB0U q+YbJ8tIQk8G3/XhioXOGNK1Tw//mlhPqXBtAzCQJbMBnK73BwRzWLqsF9FReD058r/m Ot+xrUDSMPrFDjG+zYYXnXZ8R7QxnhNMUC5qJBbUhjt6AeaNs5NhC2rh2eSzqxtUJxj/ fpg0uQpd82fwiYBGYGpXUHVscdGCURzkQdHL3rIB8dosksgqhlD56hmoP0lSmoxYfm2y /RmO3tMJFLZa1GhhuLMmfzyeiWEPgYikj9isIfbflffLJpXum7sYdhufdIUJqnDS3CUP CrcQ== 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=4Gsk+PU6zv89mFYfFw3XbKhLrnW0DMZFFqe7xZQfb8k=; b=P1yk76/uupxM2q+ZcGVzJXIIjba8Hg/Wc+1EkTBkLyKA5xhtXY3GAzT/V4tE3KdSBP frZ2HCFlJXJSVfIfN+YyLJdGzJY5zw+U8BhbQS9mPxUTrsCUBjha1+HKA6DOURG3IfEL OOkvDBAmhXwnKYabzkO28+omrErUspEFUpgKluXh2i8wgf0Kqpabstyvif12/pEW+69O 52+GyUySilnsQseRQJikQD3sJxZ1hGbsDJ+8EWd2r6bJXPoO9Qcx6SAwSOrDxf/zpeIA GbDs8sDFJHDpiMuwXGuA4qfF/QRFPZ9aKvv5Zzx2zs7w5OM4ZPP/dIULL4SLQWUIMTxL uV+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=f4jCW1Q8; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si14958415ill.114.2021.08.02.14.07.06; Mon, 02 Aug 2021 14:07:17 -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=@google.com header.s=20161025 header.b=f4jCW1Q8; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231681AbhHBVGf (ORCPT + 99 others); Mon, 2 Aug 2021 17:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231605AbhHBVGe (ORCPT ); Mon, 2 Aug 2021 17:06:34 -0400 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05D2EC061760 for ; Mon, 2 Aug 2021 14:06:25 -0700 (PDT) Received: by mail-yb1-xb31.google.com with SMTP id z18so3888358ybg.8 for ; Mon, 02 Aug 2021 14:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4Gsk+PU6zv89mFYfFw3XbKhLrnW0DMZFFqe7xZQfb8k=; b=f4jCW1Q8XIGNV8OibA8486wQbNvDzvRs7inZpSU50AT1zf+1dggjCx+NvLT6vP+sU8 RkwtH8wx0ov2K7pkUNwHW1o+3vX9UIxVZHk6eThI0eFWvCp7qbco/iRhz6hqPh+tuipQ P4TgM4jJd371kZhrg+03Avzt6tF+gMBK15AM+nvRgnQ27HOXrprBefRlJNarze5fE03m OcnjM5rvSqwmLRpVO1q6owHuFKHjuBaaJsFMpiDehejIlWWQmabZ+FwcLSZJIobhJDNL uqv9uWA2Snc9PqOo3SdXjINIZFCdnQp0MxKiE38cCsBKCiYJ78Ewxr8Z+nM+eMuOpJdQ XxQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4Gsk+PU6zv89mFYfFw3XbKhLrnW0DMZFFqe7xZQfb8k=; b=QBSyCqtnhj2B0kWb3ew0uBAXtvRPlbue6NC+auJRn0rOuH7yYC2kUKMmkwwHdvyzHM 2fuOVX9BHgbQyAjG0Bno9cNS0aVysRFK+gkTAQSTP6sljYZXDG8xUJc2INJanIe/L1nR 7ZqXrSqtrVyl6kvEqPmtJwPV+qHN0b9ha8sRjGeTe8/rDbQyh1S7kIttNOMDpz3RBb8h vMtNsYCcbTnj63s1CB+xuR0G98kTxfugkzOsUAmVaHa1W4CE+/jJnh5azVCBrgPZSmGQ 9kS02MPZ6xCag1paEDm//QDwmAONO55IcI62rsZ29JwreQA8jztEIGtSf+goaqEZD7ze TtCw== X-Gm-Message-State: AOAM533B+w+8twlycHI1iT7utV2ZT5hIzY+ab5WWvUDGqSecJC55gEUF AIiKDEJhHbpcB+uZGLkzz5NXaLEnUhAOCUqOJsjhSg== X-Received: by 2002:a05:6902:1549:: with SMTP id r9mr24716376ybu.308.1627938384181; Mon, 02 Aug 2021 14:06:24 -0700 (PDT) MIME-Version: 1.0 References: <20210802183910.1802120-1-ndesaulniers@google.com> <20210802183910.1802120-2-ndesaulniers@google.com> In-Reply-To: <20210802183910.1802120-2-ndesaulniers@google.com> From: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Date: Mon, 2 Aug 2021 14:06:13 -0700 Message-ID: Subject: Re: [PATCH v6 1/3] Makefile: move initial clang flag handling into scripts/Makefile.clang To: Nick Desaulniers Cc: Masahiro Yamada , Miguel Ojeda , 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 , Nathan Chancellor Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 2, 2021 at 11:39 AM Nick Desaulniers 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/. > > Reviewed-by: Nathan Chancellor > Signed-off-by: Nick Desaulniers > --- > 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 19135a9d778e..3af8d39f43ef 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -4501,6 +4501,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 6b555f64df06..444558e62cbc 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 -i* options are for includes. -fintegrated-as is the canonical spelling. Since -fintegrated-as is the default (for most llvm/lib/Target/ targets and the ones clang builds actually support), it can even be deleted. > +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 > -- > 2.32.0.554.ge1b32706d8-goog >